package deferAndPanic

import "fmt"

func main() {
	v1 := testDefer()
	v2 := testDefer2()
	v3 := testDefer3()

	fmt.Println(v1, v2, v3)
}

func testDefer() int {
	val := 5
	defer func() {
		val++
	}()
	return val
}

func testDefer2() (val int) {
	val = 5
	defer func() {
		val++
		val = 1
	}()
	return
}

func testDefer3() (val int) {
	val = 5
	defer func() {
		val++
	}()
	return val
}
